import http from "@/common/http/request";
import { messageCateAdd, messageCateListInterface, messageCateUpdate, messageListInterface } from "./message.interface";

// 留言列表
export const $getMessageList = (data: messageListInterface) => {
  const $http = new http();
  return $http.get({
    url: '/hlas/message/list',
    data,
  })
}


//留言详情
export const $messageDetail = (id: number) => {
  const $http = new http();
  return $http.get({
    url: `/hlas/message/${id}`,
  })
}
//删除留言
export const $messageDetele = (data: Array<string>) => {
  const $http = new http();
  return $http.delete({
    url: `/hlas/message/${data.join(',')}`,
  })
}

//留言分类列表
export const $getMessageCateList = (data: messageCateListInterface) => {
  const $http = new http();
  return $http.get({
    url: '/hlas/messageCate/list',
    data,
  })
}

//留言分类详情
export const $messageCateDetail = (id: number) => {
  const $http = new http();
  return $http.get({
    url: `/hlas/messageCate/${id}`,
  })
}

//编辑留言分类
export const $messageCateUpdate = (data: messageCateUpdate) => {
  const $http = new http();
  return $http.put({
    url: '/hlas/messageCate',
    data,
  })
}

//添加留言分类
export const $messageCateAdd = (data: messageCateAdd) => {
  const $http = new http();
  return $http.post({
    url: '/hlas/messageCate',
    data,
  })
}

//删除留言分类
export const $messageCateDetele = (data: Array<string>) => {
  const $http = new http();
  return $http.delete({
    url: `/hlas/messageCate/${data.join(',')}`,
  })
}